import CTextAreaForm from '@/components/CTextAreaForm/CTextAreaForm'
import { Col, Form, useFormState } from '@douyinfe/semi-ui'

interface IDictFormItem {}

export default function DictFormItem(props: IDictFormItem) {
  const formState = useFormState()
  return (
    <>
      <Col span={24}>
        <Form.Input
          field="name"
          rules={[
            {
              required: true,
              message: `请输入${
                formState.values.type === 1 ? '字典名称' : '字典项名称'
              }`,
            },
          ]}
          showClear
          label={formState.values.type === 1 ? '字典名称' : '字典项名称'}
        />
      </Col>
      <Col span={24}>
        <Form.Input
          field={formState.values.type === 1 ? 'dictKey' : 'value'}
          rules={[
            {
              required: true,
              message: `请输入${
                formState.values.type === 1 ? '字典Key' : '字典项Value'
              }`,
            },
          ]}
          showClear
          label={formState.values.type === 1 ? '字典Key' : '字典项Value'}
        />
      </Col>
      <Col span={24}>
        <Form.InputNumber
          showClear
          className="w100"
          field="orderNo"
          label="排序号"
        />
      </Col>
      <Col span={24}>
        <Form.Switch field="enableFlag" label="启用" />
      </Col>
      <Col span={24}>
        <CTextAreaForm></CTextAreaForm>
      </Col>
    </>
  )
}
